package com.ruoyi.service;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;

/**
 * @author jierui
 * @package com.ruoyi.service
 * @date 2021/8/23-14:06
 * @description:
 */
public class IdTestCallable implements Callable {

    private GuidRedisService guidRedisService;

    private int n;

    public IdTestCallable(GuidRedisService guidRedisService, int n) {
        this.guidRedisService = guidRedisService;
        this.n = n;
    }

    @Override
    public Object call() throws Exception {

        Set<Long> idSet=new HashSet<>();
        for(int i=0;i<n;i++){
            idSet.add(guidRedisService.nextId());
        }

        return idSet;
    }
}
